package com.osp.model;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;


public class Employee {
	
	Map<Integer,ArrayList<Task>> tasks = new HashMap<Integer,ArrayList<Task>>();
	private String name;
	
	
	public Employee(String name){
		this.name = name;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Map<Integer,ArrayList<Task>> getTasks(){
		return tasks;
	}
	
	public void addTask(Task task){
		Integer year;
		year = task.getDate().get(Calendar.YEAR);
		if(tasks.get(year)==null){
			tasks.put(year, new ArrayList<Task>());
		}
		tasks.get(year).add(task);	
	}

	@Override
	public String toString() {
		return name;
	}
	
		
	public boolean equals(Object that) {
		if (that instanceof Employee) {
			return ((Employee)that).getName().equals(this.getName());
		}
		return false;
	}

	@Override
	public int hashCode() {
		return this.getName().hashCode();
	}
	
	
	
}
